home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / gg / guile-1.4.1.lha / README.goops < prev    next >
Text File  |  2001-03-10  |  6KB  |  168 lines

  1. This is release 1.0.2 of GOOPS, or
  2. Guile Object Oriented Programming System.
  3.  
  4. Please send bug reports to bug-guile@gnu.org.
  5.  
  6. GOOPS is the object oriented extension to Guile. Its implementation is
  7. derived from STk-3.99.3 by Erick Gallesio and version 1.3 of Gregor
  8. Kiczales `Tiny-Clos'.  It is very close in spirit to CLOS, the Common
  9. Lisp Object System (`CLtL2') but is adapted for the Scheme language.
  10. While GOOPS is not compatible with any of these systems, GOOPS
  11. contains a compatibility module which allows for execution of STKlos
  12. programs.
  13.  
  14. Briefly stated, the GOOPS extension gives the user a full object
  15. oriented system with multiple inheritance and generic functions with
  16. multi-method dispatch.  Furthermore, the implementation relies on a
  17. true meta object protocol, in the spirit of the one defined for CLOS
  18. (Gregor Kiczales: A Metaobject Protocol).
  19.  
  20.  
  21. Getting started ======================================================
  22.  
  23. [Most of this section can be found in the texinfo documentation as well.]
  24.  
  25. 1. Make sure that you have a version of Guile later than or equal to
  26.    1.3.2 and earlier than 1.5 installed on your system.  (You can type
  27.  
  28.      guile -c '(write-line (version))'
  29.  
  30.    in your terminal window to check which version of Guile you have.)
  31.    If not, see under "Obtaining GOOPS" how to get it.
  32.  
  33. 2. Make sure that you stand in the `guile-oops' directory and type
  34.  
  35.      ./configure
  36.  
  37.    This will configure GOOPS for your system.
  38.  
  39. 3. Type
  40.  
  41.      make install
  42.  
  43.    to build and install GOOPS.
  44.  
  45. If everything went well we're ready to enter the interpreter:
  46.  
  47. 4. Type
  48.  
  49.      guile-oops
  50.  
  51.    You should now be at the Guile prompt ("guile> ").
  52.  
  53. 5. Type
  54.  
  55.      (use-modules (oop goops))
  56.  
  57.    to load GOOPS.  (If your system supports dynamic loading, you
  58.    should be able to do this not only from `guile-oops' but from an
  59.    arbitrary Guile interpreter.)
  60.  
  61. We're now ready to try some basic GOOPS functionality.
  62.  
  63. Generic functions
  64.  
  65.   (define-method (+ (x <string>) (y <string>))
  66.     (string-append x y))
  67.  
  68.   (+ 1 2) --> 3
  69.   (+ "abc" "de") --> "abcde"
  70.  
  71. User-defined types
  72.  
  73.   (define-class <2D-vector> ()
  74.     (x #:init-value 0 #:accessor x-component #:init-keyword #:x)
  75.     (y #:init-value 0 #:accessor y-component #:init-keyword #:y))
  76.  
  77.   (use-modules (ice-9 format))
  78.  
  79.   (define-method (write (obj <2D-vector>) port)
  80.     (display (format #f "<~S, ~S>" (x-component obj) (y-component obj))
  81.          port))
  82.  
  83.   (define v (make <2D-vector> #:x 3 #:y 4))
  84.   v --> <3, 4>
  85.  
  86.   (define-method (+ (x <2D-vector>) (y <2D-vector>))
  87.     (make <2D-vector>
  88.           #:x (+ (x-component x) (x-component y))
  89.           #:y (+ (y-component x) (y-component y))))
  90.  
  91.   (+ v v) --> <6, 8>
  92.  
  93. Asking for the type of an object
  94.  
  95.   (class-of v) --> #<<class> <2D-vector> 40241ac0>
  96.   <2D-vector>  --> #<<class> <2D-vector> 40241ac0>
  97.   (class-of 1) --> #<<class> <integer> 401b2a98>
  98.   <integer>    --> #<<class> <integer> 401b2a98>
  99.  
  100.   (is-a? v <2D-vector>) --> #t
  101.  
  102. See further in the GOOPS tutorial available in this distribution in
  103. info (goops.info) and texinfo format.
  104.  
  105.  
  106. Some words of caution ================================================
  107.  
  108. This is the first release of GOOPS.  It could also be the last, since
  109. GOOPS has now been merged into Guile.
  110.  
  111. While the basic functionality won't change much in the future, the
  112. MOP, more advanced features, and the internal representation will
  113. continue to move.
  114.  
  115. The generic function application protocol is based upon an idea from
  116. PCL: We only compute the applicable methods for a certain type
  117. combination once, and then cache it.
  118.  
  119. Currently, only the cache lookup mechanism is purely implemented in C.
  120. Most other parts have been prototyped in Scheme.  This means that
  121. while GOOPS is extremely efficient when executing code many times, the
  122. first pass through the code is slow.
  123.  
  124. NOTE: The generic function application MOP is not yet implemented, so
  125.       it is not yet possible to customize the behaviour of GF
  126.       application by specializing apply-generic to a GF class of your
  127.       own making.
  128.  
  129. We're very interested in comments about how GOOPS performs in larger
  130. projects.  If you have any, please feel welcome to write to
  131. Mikael Djurfeldt <djurfeldt@nada.kth.se>.
  132.  
  133.  
  134. Anonymous CVS Access and FTP snapshots ===============================
  135.  
  136. We make the developers' working Guile sources available via anonymous
  137. CVS, and by nightly snapshots, accessible via FTP.  See the files
  138. `ANON-CVS' and `SNAPSHOTS' for details.
  139.  
  140. If you would like to receive mail when people commit changes to the
  141. Guile CVS repository, you can subscribe to guile-cvs@sourceware.cygnus.com
  142. by sending a message to guile-cvs-subscribe@sourceware.cygnus.com.  Even
  143. better, you can get daily digests of these commit messages by sending
  144. a message to guile-cvs-digest-subscribe@sourceware.cygnus.com.
  145.  
  146. If you want to subscribe an e-mail address other than the one that
  147. appears in your From: header, say foo@bar.com, send a mail note to
  148. guile-cvs-subscribe-foo=bar.com@sourceware.cygnus.com.
  149.  
  150.  
  151. Obtaining GOOPS ======================================================
  152.  
  153. The latest official GOOPS release is available via anonymous FTP from
  154. ftp.gnu.org, as /pub/gnu/guile/guile-oops-1.0.2.tar.gz.
  155.  
  156. Via the web, that's:  ftp://ftp.gnu.org/pub/gnu/guile/guile-oops-1.0.2.tar.gz
  157. For getit, that's:    ftp.gnu.org:/pub/gnu/guile/guile-oops-1.0.2.tar.gz
  158.  
  159. If you don't already have Guile 1.4 installed on your system, you
  160. also need to download and install
  161. ftp://ftp.gnu.org/pub/gnu/guile/guile-1.4.tar.gz
  162.  
  163. The mailing list `guile@sourceware.cygnus.com' carries discussions,
  164. questions, and often answers, about Guile.  To subscribe, send mail to
  165. guile-subscribe@sourceware.cygnus.com.  Of course, please send bug
  166. reports (and fixes!) to bug-guile@gnu.org.  Note that one address is
  167. @sourceware.cygnus.com, and the other is at @gnu.org.
  168.